<?php

/**
 * Activity wrapper, present activity in a better way.
 * 
 * @author james
 *
 */
class Custom_ActivityWrapper {
	
	public $user;
	public $invitaiton;
	public $targetUser;
	public $activityType;
	public $object_id;
	
	/**
	 * Constructor.
	 * 
	 * @param $user_id
	 * @param $targetUser_id
	 * @param $activityType
	 * @param $object_id
	 */
	public function __construct($user_id, $targetUser_id, $activityType, $object_id) {
		$this->user_id = User::findById($user_id);
		$this->targetUser_id = User::findById($targetUser_id);
		$this->activityType = $activityType;
		$this->object_id = $object_id;
	}
	
	/**
	 * @return return activity string to be present on the site
	 */
	public function toString() {
		$activityString = "";
		switch($this->activityType) {
			case Activity::INVITATION_COMMENT:
				$invitation = Invitation::findById($this->object_id);
				$acitivityStrng = $user->username." 在你的邀请".$invitaion->title."里发表了评论";
				break;
			case Activity::INVITATION_REPLY:
				$invitation = Invitation::findById($this->object_id);
				$activityString = $user->username." 回复了你的邀请".$invitation->title;
				break;
			case Activity::INVITATION_CREATE:
				$invitation = Invitation::findById($this->object_id);
				$activityString = "你创建了一个新邀请<strong>".$invitation->title.'</strong>';
		}
		return $activityString;
	}
}
?>